MODULE SUSSURF_PARAMS_MOD
CONTAINS
  SUBROUTINE SUSSURF_PARAMS(TMP_SURF,YDSOIL,YDVEG,YDAGS,YDFLAKE,YDEXC,YDURB)
USE PARKIND1  , ONLY : JPIM, JPRB, JPRD
USE YOMHOOK   , ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOS_NAMPARS1, ONLY : TESURF
USE YOS_SOIL  , ONLY : TSOIL
USE YOS_VEG   , ONLY : TVEG
USE YOS_AGS   , ONLY : TAGS
USE YOS_FLAKE , ONLY : TFLAKE
USE YOS_EXC   , ONLY : TEXC
USE YOS_URB   , ONLY : TURB
USE CPTAVE_MOD

! (C) Copyright 2025- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

!**   *SUSSURF_PARAMS* 

!     PURPOSE
!     -------
!          THIS ROUTINE TRANSFERS THE PARAMTERS READ FROM AN EXTERNAL NAMELIST
!     TO THE CORRESPONDING DERIVED TYPE

!     INTERFACE.
!     ----------

!     METHOD.
!     -------

!     EXTERNALS.
!     ----------

!     REFERENCE.
!     ----------

!     Original    M. KELBLING         UFZ             20/10/28

!     MODIFICATIONS
!     -------------
!     I. Ayan-Miguez (BSC)  Oct 2023: Added urban parameters
!     ------------------------------------------------------------------


IMPLICIT NONE

! Declaration of arguments
TYPE(TESURF) ,INTENT(IN)    :: TMP_SURF
TYPE(TSOIL)  ,INTENT(INOUT) :: YDSOIL
TYPE(TVEG)   ,INTENT(INOUT) :: YDVEG
TYPE(TAGS)   ,INTENT(INOUT) :: YDAGS
TYPE(TFLAKE) ,INTENT(INOUT) :: YDFLAKE
TYPE(TEXC)   ,INTENT(INOUT) :: YDEXC
TYPE(TURB)   ,INTENT(INOUT) :: YDURB

REAL(KIND=JPHOOK) :: ZHOOK_HANDLE

!     ------------------------------------------------------------------


IF (LHOOK) CALL DR_HOOK('SUSSURF_PARAMS_MOD:SUSSURF_PARAMS',0,ZHOOK_HANDLE)

! --------------------------------------------------
!  -- SNOW -----------------------------------------
! --------------------------------------------------

YDSOIL%RLWCSWEA        = TMP_SURF%RLWCSWEA
YDSOIL%RLWCSWEB        = TMP_SURF%RLWCSWEB
YDSOIL%RLWCSWEC        = TMP_SURF%RLWCSWEC
YDSOIL%RTEMPAMP        = TMP_SURF%RTEMPAMP
YDSOIL%RHOMINSNA       = TMP_SURF%RHOMINSNA
YDSOIL%RHOMINSNB       = TMP_SURF%RHOMINSNB
YDSOIL%RHOMINSNC       = TMP_SURF%RHOMINSNC
YDSOIL%RHOMINSND       = TMP_SURF%RHOMINSND
YDSOIL%RSNDTOVERA      = TMP_SURF%RSNDTOVERA
YDSOIL%RSNDTOVERB      = TMP_SURF%RSNDTOVERB
YDSOIL%RSNDTOVERC      = TMP_SURF%RSNDTOVERC
YDSOIL%RSNDTDESTA      = TMP_SURF%RSNDTDESTA
YDSOIL%RSNDTDESTB      = TMP_SURF%RSNDTDESTB
YDSOIL%RSNDTDESTC      = TMP_SURF%RSNDTDESTC
YDSOIL%RSNDTDESTROI    = TMP_SURF%RSNDTDESTROI
YDSOIL%RHOMAXSN_NEW    = TMP_SURF%RHOMAXSN_NEW
YDSOIL%RSNDAMOB        = TMP_SURF%RSNDAMOB
YDSOIL%RSNDMOB         = TMP_SURF%RSNDMOB
YDSOIL%RSNDAW          = TMP_SURF%RSNDAW
YDSOIL%RSNDBW          = TMP_SURF%RSNDBW
YDSOIL%RSNDKV          = TMP_SURF%RSNDKV
YDSOIL%RSNDATAUW       = TMP_SURF%RSNDATAUW
YDSOIL%RSNDBTAUW       = TMP_SURF%RSNDBTAUW
YDSOIL%RSNDWCOMPMAX    = TMP_SURF%RSNDWCOMPMAX
YDSOIL%SSAG1           = TMP_SURF%SSAG1
YDSOIL%SSAG2           = TMP_SURF%SSAG2
YDSOIL%SSAG3           = TMP_SURF%SSAG3
YDSOIL%SSAGSNSMAX      = TMP_SURF%SSAGSNSMAX
YDSOIL%SSASNEXTMIN     = TMP_SURF%SSASNEXTMIN
YDSOIL%SSASNEXTMAX     = TMP_SURF%SSASNEXTMAX
YDSOIL%SSASNEXTCNST    = TMP_SURF%SSASNEXTCNST
YDSOIL%SNHCONDAV       = TMP_SURF%SNHCONDAV
YDSOIL%SNHCONDBV       = TMP_SURF%SNHCONDBV
YDSOIL%SNHCONDCV       = TMP_SURF%SNHCONDCV
YDSOIL%SNHCONDPOV      = TMP_SURF%SNHCONDPOV
YDSOIL%RSNLARGE        = TMP_SURF%RSNLARGE
YDSOIL%RSNLARGESN      = TMP_SURF%RSNLARGESN
YDSOIL%RSNLARGEWT      = TMP_SURF%RSNLARGEWT
YDSOIL%RSNSNOW         = TMP_SURF%RSNSNOW
YDSOIL%RSNSNOWHVEG     = TMP_SURF%RSNSNOWHVEG
YDSOIL%RSNRTTEMP       = TMP_SURF%RSNRTTEMP
YDSOIL%RSNPERT         = TMP_SURF%RSNPERT
YDSOIL%RSNGLC          = TMP_SURF%RSNGLC
YDSOIL%RSMINZ          = TMP_SURF%RSMINZ
YDSOIL%RLICE           = TMP_SURF%RLICE
YDSOIL%RQSNCRINV       = TMP_SURF%RQSNCRINV
YDSOIL%RDARSICE        = TMP_SURF%RDARSICE
YDSOIL%RDANSICE        = TMP_SURF%RDANSICE
YDSOIL%RRCSICE         = TMP_SURF%RRCSICE
YDSOIL%RCONDSICE       = TMP_SURF%RCONDSICE
YDSOIL%FSNTCONDA       = TMP_SURF%FSNTCONDA
YDSOIL%FSNTCONDB       = TMP_SURF%FSNTCONDB
YDSOIL%FSNTCONDC       = TMP_SURF%FSNTCONDC
YDSOIL%RSNPER          = TMP_SURF%RSNPER
YDSOIL%RHOMINSN        = TMP_SURF%RHOMINSN
YDSOIL%RHODELTASN      = TMP_SURF%RHODELTASN
YDSOIL%RTAUF           = TMP_SURF%RTAUF
YDSOIL%RTAUA           = TMP_SURF%RTAUA
YDSOIL%RALAMSN         = TMP_SURF%RALAMSN
YDSOIL%RDSNMAX         = TMP_SURF%RDSNMAX
YDSOIL%RSFRESH         = TMP_SURF%RSFRESH
YDSOIL%RALFMINSN       = TMP_SURF%RALFMINSN
YDSOIL%RALFMAXSN       = TMP_SURF%RALFMAXSN

! --------------------------------------------------
!  -- SOIL -----------------------------------------
! --------------------------------------------------

YDSOIL%RTF1            = TMP_SURF%RTF1
YDSOIL%RTF2            = TMP_SURF%RTF2
YDSOIL%RLAMBDAICE      = TMP_SURF%RLAMBDAICE
YDSOIL%RLAMBDAWAT      = TMP_SURF%RLAMBDAWAT
YDSOIL%RKERST1         = TMP_SURF%RKERST1
YDSOIL%RKERST2         = TMP_SURF%RKERST2
YDSOIL%RKERST3         = TMP_SURF%RKERST3
YDSOIL%RSRDEP          = TMP_SURF%RSRDEP
YDSOIL%RSIGORMIN       = TMP_SURF%RSIGORMIN
YDSOIL%RSIGORMAX       = TMP_SURF%RSIGORMAX
YDSOIL%RWLMAX          = TMP_SURF%RWLMAX
YDSOIL%RPSFR           = TMP_SURF%RPSFR
YDSOIL%RBARPWP         = TMP_SURF%RBARPWP
YDSOIL%RVGBARCAP       = TMP_SURF%RVGBARCAP
YDSOIL%RBARCAP         = TMP_SURF%RBARCAP
YDSOIL%RCLU            = TMP_SURF%RCLU
YDSOIL%RRSF1A          = TMP_SURF%RRSF1A
YDSOIL%RRSF1B          = TMP_SURF%RRSF1B
YDSOIL%RRSF1C          = TMP_SURF%RRSF1C
YDSOIL%RRHOSM          = TMP_SURF%RRHOSM
YDSOIL%RLAMBDAQ        = TMP_SURF%RLAMBDAQ
YDSOIL%RLAMBDAO        = TMP_SURF%RLAMBDAO
YDSOIL%RLAMBDAMIN      = TMP_SURF%RLAMBDAMIN
YDSOIL%RLAMBDAMAX      = TMP_SURF%RLAMBDAMAX
YDSOIL%RLAMBDRYMA      = TMP_SURF%RLAMBDRYMA
YDSOIL%RLAMBDRYMB      = TMP_SURF%RLAMBDRYMB
YDSOIL%RLAMBDRYMC      = TMP_SURF%RLAMBDRYMC
YDSOIL%RTFREEZSICECEL  = TMP_SURF%RTFREEZSICECEL
YDSOIL%RTMELTSICECEL   = TMP_SURF%RTMELTSICECEL

! --------------------------------------------------
!  -- VEGETATION -----------------------------------
! --------------------------------------------------
YDVEG%RVQ10A           = TMP_SURF%RVQ10A
YDVEG%RVQ10B           = TMP_SURF%RVQ10B
YDVEG%RVQ10C           = TMP_SURF%RVQ10C
YDVEG%RVQ10D           = TMP_SURF%RVQ10D
YDVEG%RVQ10MIN         = TMP_SURF%RVQ10MIN
YDVEG%RVINTER          = TMP_SURF%RVINTER
YDVEG%RLHAERO          = TMP_SURF%RLHAERO
YDVEG%RLHAEROS         = TMP_SURF%RLHAEROS
YDVEG%RCEPSW           = TMP_SURF%RCEPSW
YDVEG%RVLAMSK_DESERT   = TMP_SURF%RVLAMSK_DESERT
YDVEG%RVLAMSK_SNOW     = TMP_SURF%RVLAMSK_SNOW
YDVEG%RVLAMSKS_DESERT  = TMP_SURF%RVLAMSKS_DESERT
YDVEG%RVLAMSKS_SNOW    = TMP_SURF%RVLAMSKS_SNOW
YDVEG%RVZ0M_BARE       = TMP_SURF%RVZ0M_BARE
YDVEG%RVZ0M_SNOW       = TMP_SURF%RVZ0M_SNOW
YDVEG%RVZ0H_BARE       = TMP_SURF%RVZ0H_BARE
YDVEG%RVZ0H_SNOW       = TMP_SURF%RVZ0H_SNOW

! --------------------------------------------------
!  -- AGS ------------------------------------------
! --------------------------------------------------
YDAGS%RAW              = TMP_SURF%RAW
YDAGS%RASW             = TMP_SURF%RASW
YDAGS%RBW              = TMP_SURF%RBW
YDAGS%RDMAXN           = TMP_SURF%RDMAXN
YDAGS%RDMAXX           = TMP_SURF%RDMAXX
YDAGS%RPARCF           = TMP_SURF%RPARCF
YDAGS%RPCCO2           = TMP_SURF%RPCCO2
YDAGS%RIAOPT           = TMP_SURF%RIAOPT
YDAGS%RDSPOPT          = TMP_SURF%RDSPOPT
YDAGS%RXGT             = TMP_SURF%RXGT
YDAGS%RDIFRACF         = TMP_SURF%RDIFRACF
YDAGS%RSHP1AMMAX       = TMP_SURF%RSHP1AMMAX
YDAGS%RSHP2AMMAX       = TMP_SURF%RSHP2AMMAX
YDAGS%RSHP1GMES        = TMP_SURF%RSHP1GMES
YDAGS%RSHP2GMES        = TMP_SURF%RSHP2GMES
YDAGS%RMAXFZERO        = TMP_SURF%RMAXFZERO
YDAGS%RCC_NIT_BASE_DIL = TMP_SURF%RCC_NIT_BASE_DIL
YDAGS%RLAIB_NITROA     = TMP_SURF%RLAIB_NITROA
YDAGS%RLAIB_NITROB     = TMP_SURF%RLAIB_NITROB
YDAGS%RLAIB_NITROMIN   = TMP_SURF%RLAIB_NITROMIN
YDAGS%RVGMES_FLDEXP    = TMP_SURF%RVGMES_FLDEXP
YDAGS%RESPBSTR_COEF    = TMP_SURF%RESPBSTR_COEF
YDAGS%REPS_COEF        = TMP_SURF%REPS_COEF
YDAGS%RGSC_COEF        = TMP_SURF%RGSC_COEF
YDAGS%RXBOMEGA         = TMP_SURF%RXBOMEGA
YDAGS%RRDCF            = TMP_SURF%RRDCF
YDAGS%RCONDCTMIN       = TMP_SURF%RCONDCTMIN
YDAGS%RCONDSTMIN       = TMP_SURF%RCONDSTMIN
YDAGS%RANFMINIT        = TMP_SURF%RANFMINIT
YDAGS%RRESPFACTOR_NIT  = TMP_SURF%RRESPFACTOR_NIT
YDAGS%RCNS_NIT         = TMP_SURF%RCNS_NIT
YDAGS%RCA_1X_CO2_NIT   = TMP_SURF%RCA_1X_CO2_NIT
YDAGS%RCA_2X_CO2_NIT   = TMP_SURF%RCA_2X_CO2_NIT
YDAGS%RCC_NIT          = TMP_SURF%RCC_NIT
YDAGS%RCO2FRAC         = TMP_SURF%RCO2FRAC

! --------------------------------------------------
!  -- FLAKE ----------------------------------------
! --------------------------------------------------
YDFLAKE%RC_SHAPE               = TMP_SURF%RC_SHAPE
YDFLAKE%RC_OC_MAXICEZ          = TMP_SURF%RC_OC_MAXICEZ
YDFLAKE%RC_OC_MAXDEPTH         = TMP_SURF%RC_OC_MAXDEPTH
YDFLAKE%RC_CBL_1               = TMP_SURF%RC_CBL_1
YDFLAKE%RC_CBL_2               = TMP_SURF%RC_CBL_2
YDFLAKE%RC_SBL_ZM_N            = TMP_SURF%RC_SBL_ZM_N
YDFLAKE%RC_SBL_ZM_S            = TMP_SURF%RC_SBL_ZM_S
YDFLAKE%RC_SBL_ZM_I            = TMP_SURF%RC_SBL_ZM_I
YDFLAKE%RC_RELAX_H             = TMP_SURF%RC_RELAX_H
YDFLAKE%RC_RELAX_C             = TMP_SURF%RC_RELAX_C
YDFLAKE%RC_T_MIN               = TMP_SURF%RC_T_MIN
YDFLAKE%RC_T_MAX               = TMP_SURF%RC_T_MAX
YDFLAKE%RC_B1                  = TMP_SURF%RC_B1
YDFLAKE%RC_B2                  = TMP_SURF%RC_B2
YDFLAKE%RC_S_LIN               = TMP_SURF%RC_S_LIN
YDFLAKE%RPHI_S_PR0_LIN         = TMP_SURF%RPHI_S_PR0_LIN
YDFLAKE%RC_I_LIN               = TMP_SURF%RC_I_LIN
YDFLAKE%RPHI_I_PR0_LIN         = TMP_SURF%RPHI_I_PR0_LIN
YDFLAKE%RPHI_I_PR1_LIN         = TMP_SURF%RPHI_I_PR1_LIN
YDFLAKE%RH_ICE_MAX             = TMP_SURF%RH_ICE_MAX
YDFLAKE%RTPL_A_T               = TMP_SURF%RTPL_A_T
YDFLAKE%ROPT_WAT_EXTC1_REF     = TMP_SURF%ROPT_WAT_EXTC1_REF
YDFLAKE%ROPT_WAT_FRAC1_TRANS   = TMP_SURF%ROPT_WAT_FRAC1_TRANS
YDFLAKE%ROPT_WAT_EXTC1_TRANS   = TMP_SURF%ROPT_WAT_EXTC1_TRANS
YDFLAKE%ROPT_WAT_EXTC2_TRANS   = TMP_SURF%ROPT_WAT_EXTC2_TRANS
YDFLAKE%ROPT_WICE_EXTC1_REF    = TMP_SURF%ROPT_WICE_EXTC1_REF
YDFLAKE%ROPT_BICE_EXTC1_REF    = TMP_SURF%ROPT_BICE_EXTC1_REF
YDFLAKE%ROPT_ICE_EXTC1_OP      = TMP_SURF%ROPT_ICE_EXTC1_OP
YDFLAKE%RDEPTH_W_MAX           = TMP_SURF%RDEPTH_W_MAX
YDFLAKE%RDEPTH_W_MIN           = TMP_SURF%RDEPTH_W_MIN
YDFLAKE%RD_C_T_DT_MAX_A        = TMP_SURF%RD_C_T_DT_MAX_A
YDFLAKE%RC_I_FLK_A             = TMP_SURF%RC_I_FLK_A
YDFLAKE%RH_ICE_FUSION_A        = TMP_SURF%RH_ICE_FUSION_A
YDFLAKE%RH_ICE_FUSION_B        = TMP_SURF%RH_ICE_FUSION_B
YDFLAKE%RT_ICE_MIN_FLK         = TMP_SURF%RT_ICE_MIN_FLK
YDFLAKE%RCONV_EQUIL_A          = TMP_SURF%RCONV_EQUIL_A
YDFLAKE%RCONV_EQUIL_B          = TMP_SURF%RCONV_EQUIL_B
YDFLAKE%RCONV_EQUIL_C          = TMP_SURF%RCONV_EQUIL_C

! --------------------------------------------------
!  -- EXC ------------------------------------------
! --------------------------------------------------
YDEXC%RSSRFLTIMAX       = TMP_SURF%RSSRFLTIMAX
YDEXC%RBLENDWMO         = TMP_SURF%RBLENDWMO
YDEXC%RZ0MWMO           = TMP_SURF%RZ0MWMO
YDEXC%RETACONV          = TMP_SURF%RETACONV
YDEXC%RCDFC             = TMP_SURF%RCDFC
YDEXC%RBLENDSNVEG       = TMP_SURF%RBLENDSNVEG
YDEXC%RUGNA             = TMP_SURF%RUGNA
YDEXC%RUGNB             = TMP_SURF%RUGNB
YDEXC%RUGN              = TMP_SURF%RUGN
YDEXC%RKAP              = TMP_SURF%RKAP
YDEXC%RPARZIINI         = TMP_SURF%RPARZIINI
YDEXC%RZ0ICEINI         = TMP_SURF%RZ0ICEINI
YDEXC%REPUST            = TMP_SURF%REPUST
YDEXC%RNUINI            = TMP_SURF%RNUINI
YDEXC%RNUMINI           = TMP_SURF%RNUMINI
YDEXC%RNUHINI           = TMP_SURF%RNUHINI
YDEXC%RNUQINI           = TMP_SURF%RNUQINI
YDEXC%RCHAR             = TMP_SURF%RCHAR
YDEXC%RAZ0ICE           = TMP_SURF%RAZ0ICE
YDEXC%RBZ0ICE           = TMP_SURF%RBZ0ICE
YDEXC%RCZ0ICE           = TMP_SURF%RCZ0ICE
YDEXC%RDZ0ICE           = TMP_SURF%RDZ0ICE
YDEXC%RITZ0WN           = TMP_SURF%RITZ0WN
YDEXC%RACDZ0WN          = TMP_SURF%RACDZ0WN
YDEXC%RBCDZ0WN          = TMP_SURF%RBCDZ0WN
YDEXC%RXEPSZ0WN         = TMP_SURF%RXEPSZ0WN
YDEXC%RUSTMINZ0WN       = TMP_SURF%RUSTMINZ0WN
YDEXC%RPCHARMAXZ0WN     = TMP_SURF%RPCHARMAXZ0WN
YDEXC%RZ0FGZ0WN         = TMP_SURF%RZ0FGZ0WN
YDEXC%RSALIN            = TMP_SURF%RSALIN
YDEXC%RBLENDZ0          = TMP_SURF%RBLENDZ0

! --------------------------------------------------
!  -- URBAN ------------------------------------------
! --------------------------------------------------

YDURB%RBUIZ0M  = TMP_SURF%RBUIZ0M
YDURB%RWALALB  = TMP_SURF%RWALALB
YDURB%RROOALB  = TMP_SURF%RROOALB
YDURB%RROAALB  = TMP_SURF%RROAALB
YDURB%RWALEMIS = TMP_SURF%RWALEMIS
YDURB%RROOEMIS = TMP_SURF%RROOEMIS
YDURB%RROAEMIS = TMP_SURF%RROAEMIS
YDURB%RWALVHC  = TMP_SURF%RWALVHC
YDURB%RROOVHC  = TMP_SURF%RROOVHC
YDURB%RROAVHC  = TMP_SURF%RROAVHC
YDURB%RWALTC   = TMP_SURF%RWALTC
YDURB%RROOTC   = TMP_SURF%RROOTC
YDURB%RROATC   = TMP_SURF%RROATC
YDURB%RURBALP  = TMP_SURF%RURBALP
YDURB%RURBCON  = TMP_SURF%RURBCON
YDURB%RURBLAM  = TMP_SURF%RURBLAM
YDURB%RURBSAT  = TMP_SURF%RURBSAT
YDURB%RURBSRES = TMP_SURF%RURBSRES

IF (LHOOK) CALL DR_HOOK('SUSSURF_PARAMS_MOD:SUSSURF_PARAMS',1,ZHOOK_HANDLE)

!     ------------------------------------------------------------------

END SUBROUTINE SUSSURF_PARAMS
END MODULE SUSSURF_PARAMS_MOD
